<?php
/*
 * @Author: 李志刚
 * @CopyRight: 2020-2030 衡水山木枝技术服务有限公司
 * @Date: 2021-10-19 10:16:03
 * @Description: 用户基础信息表
 * @LastEditors: 李志刚
 * @LastEditTime: 2021-10-20 08:53:07
 * @FilePath: /归档/user/2021_10_19_101603_create_user.php
 */

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsers extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->id();
            $table->foreignId('level_id')->default(0)->comment('等级ID');
            $table->char('phone', 11)->comment('手机号');
            $table->string('openid', 50)->nullable()->comment('openid');
            $table->string('nickname', 50)->nullable()->comment('昵称');
            $table->string('thumb', 255)->nullable()->comment('头像');
            $table->unsignedDecimal('money')->default(0)->comment('余额');
            $table->tinyInteger('sex')->default(0)->comment('性别（0未知 1男 2女)');
            $table->date('birthday')->nullable()->comment('生日');
            $table->tinyInteger('edit_times')->default(0)->comment('修改生日次数');
            $table->tinyInteger('is_shop')->default(0)->comment('是否为店铺 1是 0否');
            $table->boolean('status')->default(1)->comment('状态 1正常 0禁用');
            $table->tinyInteger('del_flag')->default(0)->comment('删除状态（1删除 0正常）');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
